<?php include "header.html"; ?>

<div id="main">
<?php if($ts == 'list'){ ?>
<h3>友情连接列表</h3>
<table cellpadding="0" cellspacing="0">
<tr>
<td width="20">ID</td><td>名字</td><td>URL</td><td>首页</td><td>管理</td>
</tr>
<?php foreach($links as $key=>$link){ ?>
<tr class='odd'>
<td><?php echo $link['id']; ?></td><td><?php echo $link['name']; ?></td><td><?php echo $link['url']; ?></td><td><?php echo $link['inhome']; ?></td><td class='action'><a href="<?php echo $link['url'] ?>"   target="_blank" class='view'>查看</a><a href="index.php?action=link&ts=edit&id=<?php echo $link['id']; ?>" class='edit'>编辑</a><a href="index.php?action=link&ts=del&id=<?php echo $link['id']; ?>">删除</a></td>
</tr>  
<?php } ?>     
</table>
<?php } ?>

<?php if($ts == 'add'){ ?>
<h3>添加链接</h3>
<fieldset>
<form method="POST"  class="jNice" action="index.php?action=link&ts=add">
<p><label>网站名称：</label><input type="text" class="text-long" name="sitename" /></p>
<p><label>网站URL：</label><input type="text" class="text-long" name="siteurl" /></p>
<p><label>是否首页：</label><select name="siteinhome"><option value="1">首页</option><option value="0">内页</option></select></p>
<input type="submit" value="添加链接" name="" />
</form>
</fieldset>
<?php } ?>

<?php if($ts == 'edit'){ ?>
<h3>编辑链接</h3>
<fieldset>
<form method="POST"  class="jNice" action="index.php?action=link&ts=update&id=<?php echo $_GET['id']; ?>">
<p><label>网站名称：</label><input type="text" class="text-long" name="sitename" value="<?php echo $linkDate['sitename'] ?>" /></p>
<p><label>网站URL：</label><input type="text" class="text-long" name="siteurl" value="<?php echo $linkDate['siteurl'] ?>" /></p>
<p><label>是否首页：</label><select name="siteinhome"><option value="1">首页</option><option value="0">内页</option></select></p>
<input type="submit" value="修改链接" name="" />
</form>
</fieldset>
<?php } ?>
</div>

<?php include "footer.html"; ?>